package com.heima;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class Main {
    public static void main(String[] args) throws TesseractException {
        // 创建实例
        Tesseract tesseract = new Tesseract();
        // 设置字体库路径
        tesseract.setDatapath("E:\\workspace");
        // 设置语言--》简体中文: 固定写法，chi_sim.traineddata去掉后缀
        tesseract.setLanguage("chi_sim");
        File file = new File("C:\\Users\\loster\\Downloads\\a.png");
        String res = tesseract.doOCR(file);
        System.out.println("识别结果:  " + res);
    }
}